﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Abs.Core;

namespace Abs.App
{
    public partial class Default : System.Web.UI.Page
    {
        private string adminMaster = "~/MasterPages/AdminMaster.Master";
        private string userMaster = "~/MasterPages/UserMaster.Master";
        public string greeting;
        protected void Page_PreInit(object sender, EventArgs e)
        {
            
            //Determine which master page to use based on the role of the account (normal user/ admin)
            if (Session["Role"] != null && ((int)Session["Role"] == (int)Abs.Core.Models.User.RoleEnum.Admin))
            {
               MasterPageFile = adminMaster;
            }
            else
            {
                MasterPageFile = userMaster;
            }

            
        }
        
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Name"] == null)
            {
                greeting = "Guest!";
            }
            else
            {
                greeting = " " + Session["Name"] + "!";
            }
        }
    }
}